package com.jty.lib_base.room.dao

import androidx.room.*
import com.jty.lib_base.room.bean.TeachAction

@Dao
interface TeachActionDao {
    @Query("SELECT * FROM TEACH_ACTION")
    fun getAll(): List<TeachAction>

    @Query("SELECT * FROM TEACH_ACTION WHERE id IN (:ids)")
    fun loadAllByIds(ids: IntArray): List<TeachAction>

    @Query("SELECT * FROM TEACH_ACTION WHERE id = (:id) LIMIT 1")
    fun queryById(id: Long): TeachAction?


    @Insert
    fun insertAll(vararg teachActions: TeachAction)

    @Insert(onConflict = OnConflictStrategy.REPLACE) //如果有相同的id就替换； ABORT默认这个，如果相同，会报错
    fun insertTeachAction(vararg teachActions: TeachAction)

    @Delete
    fun delete(teachActions: TeachAction)

    @Delete
    fun deleteAll(vararg teachActions: TeachAction)

    @Update
    fun updateTeachActions(vararg teachActions: TeachAction)

}